using System.Data.Common;
using Microsoft.EntityFrameworkCore;

namespace Ixyu.EntityFrameworkCore
{
    public static class IxyuDbContextConfigurer
    {
        public static void Configure(DbContextOptionsBuilder<IxyuDbContext> builder, string connectionString)
        {
           
            if (connectionString.Contains("Trusted_Connection=True;"))
            {
                builder.UseSqlServer(connectionString, o =>
                {
                    o.UseRowNumberForPaging();
                });
            }
            else
            {
                builder.UseMySql(connectionString);
            }
        }

        public static void Configure(DbContextOptionsBuilder<IxyuDbContext> builder, DbConnection connection)
        {
            if (connection.ConnectionString.Contains("Trusted_Connection=True;"))
            {
                builder.UseSqlServer(connection, o => o.UseRowNumberForPaging());
            }
            else
            {
                builder.UseMySql(connection);
            }
//            
            
        }
    }
}
